﻿using System;
using System.Threading.Tasks;
//using MyPanel;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Media;
using System.Net.Http;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using System.Text.RegularExpressions;
using System.Security.Cryptography;


namespace TestProject
{
    class Program
    {
        static void Main(string[] args)
        {
            string url = "tencent://message/?uin=8971246&Menu=yes";
            System.Diagnostics.Process.Start(url);

            Console.ReadKey();
        }

        public static string GetMD5WithString(String input)
        {
            MD5 md5Hash = MD5.Create();
            // 将输入字符串转换为字节数组并计算哈希数据  
            byte[] data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input));
            // 创建一个 Stringbuilder 来收集字节并创建字符串  
            StringBuilder str = new StringBuilder();
            // 循环遍历哈希数据的每一个字节并格式化为十六进制字符串  
            for (int i = 0; i < data.Length; i++)
            {
                str.Append(data[i].ToString("x2"));//加密结果"x2"结果为32位,"x3"结果为48位,"x4"结果为64位
            }
            // 返回十六进制字符串  
            return str.ToString();
        }


        static async void test()
        {
        }
    }

    class TestClass
    {
        public Action _eventHandler;
        object _eventLock = new object();
        public event Action eventHandle
        {
            add
            {
                lock (_eventLock)
                {
                    _eventHandler -= value;
                    _eventHandler += value;
                }
            }
            remove
            {
                lock (_eventLock)
                {
                    _eventHandler -= value;
                }
            }
            
        }

        public void Method1()
        {
            Console.WriteLine("hello1");
        }
        public void Method2()
        {
            Console.WriteLine("hello2");
        }

        public void Run()
        {
            _eventHandler?.Invoke();
        }
    }
}
